package org.example.util;

public class RegularUtil {

    public static void main(String[] args) {
        /*List<Integer> list = IntStream.rangeClosed(1, 9)
                .boxed()
                .collect(Collectors.toList());
        Collections.shuffle(list);
        System.out.println(list);*/
        String timeRange = "8:30-9:00,9:00-9:30,9:30-10:00";
        if (timeRange.contains(",")) {
            String[] arr = timeRange.split(",");
            String start = arr[0].substring(0, arr[0].indexOf('-'));
            String end   = arr[arr.length - 1].substring(arr[arr.length - 1].indexOf('-') + 1);
            String mergedTime = start + "-" + end;
            System.out.println(mergedTime);
        } else {
            System.out.println(timeRange);
        }
    }
}
